import React from "react";
import { connect } from "react-redux";
import { setNameAction } from "./store/actionCreators/home";
const Index = props => {
  return (
    <div>
      {props.content || "我是首页二"}
      <button onClick={() => props.setNameAction("首页是我")}>修改名称</button>
    </div>
  );
};
// 获取state数据
const mapStateToProps = state => {
  // console.log(state);
  return state.HomeReducer;
};
const mapDispatchToProps = dispatch => {
  return {
    setNameAction(value) {
      dispatch(setNameAction(value));
    }
  };
};
export default connect(mapStateToProps, mapDispatchToProps)(Index);
